From: Isaku Yamahata Date: Mon, 29 Jun 2009 02:26:05 +0000 (+0900) Subject: [IA64] replace MAX_VCPUS with d->max_vcpus where necessary. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13678 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=025d0facf28f431e600d7aeb9b208ecd1cd50bc9;p=xen.git [IA64] replace MAX_VCPUS with d->max_vcpus where necessary. don't use MAX_VCPUS, and use vcpu::max_vcpus. The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus per guest. This patch is ia64 counter part. Signed-off-by: Isaku Yamahata --- diff --git a/xen/arch/ia64/vmx/viosapic.c b/xen/arch/ia64/vmx/viosapic.c index 8922fbe2dc..2efdb49154 100644 --- a/xen/arch/ia64/vmx/viosapic.c +++ b/xen/arch/ia64/vmx/viosapic.c @@ -378,7 +378,7 @@ static int viosapic_load(struct domain *d, hvm_domain_context_t *h) return -EINVAL; lowest_vcpu = NULL; - if (viosapic_load.lowest_vcpu_id < MAX_VIRT_CPUS) + if (viosapic_load.lowest_vcpu_id < d->max_vcpus) lowest_vcpu = d->vcpu[viosapic_load.lowest_vcpu_id]; else if (viosapic_load.lowest_vcpu_id != VIOSAPIC_INVALID_VCPU_ID) return -EINVAL; diff --git a/xen/arch/ia64/vmx/vlsapic.c b/xen/arch/ia64/vmx/vlsapic.c index e0a063afbf..b382e0b9c0 100644 --- a/xen/arch/ia64/vmx/vlsapic.c +++ b/xen/arch/ia64/vmx/vlsapic.c @@ -153,7 +153,7 @@ static void vtm_reset(VCPU *vcpu) if (vcpu->vcpu_id == 0) { vtm_offset = 0UL - ia64_get_itc(); - for (i = MAX_VIRT_CPUS - 1; i >= 0; i--) { + for (i = d->max_vcpus - 1; i >= 0; i--) { if ((v = d->vcpu[i]) != NULL) { VMX(v, vtm).vtm_offset = vtm_offset; VMX(v, vtm).last_itc = 0; @@ -227,7 +227,7 @@ void vtm_set_itc(VCPU *vcpu, uint64_t new_itc) vtm = &VMX(vcpu, vtm); if (vcpu->vcpu_id == 0) { vtm_offset = new_itc - ia64_get_itc(); - for (i = MAX_VIRT_CPUS - 1; i >= 0; i--) { + for (i = d->max_vcpus - 1; i >= 0; i--) { if ((v = d->vcpu[i]) != NULL) { VMX(v, vtm).vtm_offset = vtm_offset; VMX(v, vtm).last_itc = 0; @@ -606,7 +606,7 @@ struct vcpu *lid_to_vcpu(struct domain *d, uint16_t dest) int id = dest >> 8; /* Fast look: assume EID=0 ID=vcpu_id. */ - if ((dest & 0xff) == 0 && id < MAX_VIRT_CPUS) + if ((dest & 0xff) == 0 && id < d->max_vcpus) return d->vcpu[id]; return NULL; } @@ -875,7 +875,7 @@ static int vlsapic_load(struct domain *d, hvm_domain_context_t *h) int i; vcpuid = hvm_load_instance(h); - if (vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL) { + if (vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL) { gdprintk(XENLOG_ERR, "%s: domain has no vlsapic %u\n", __func__, vcpuid); return -EINVAL; @@ -934,7 +934,7 @@ static int vtime_load(struct domain *d, hvm_domain_context_t *h) vtime_t *vtm; vcpuid = hvm_load_instance(h); - if (vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL) { + if (vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL) { gdprintk(XENLOG_ERR, "%s: domain has no vtime %u\n", __func__, vcpuid); return -EINVAL; diff --git a/xen/arch/ia64/vmx/vmx_init.c b/xen/arch/ia64/vmx/vmx_init.c index cc898a446c..5d822f8a0b 100644 --- a/xen/arch/ia64/vmx/vmx_init.c +++ b/xen/arch/ia64/vmx/vmx_init.c @@ -623,7 +623,7 @@ int vmx_setup_platform(struct domain *d) if (d->arch.is_sioemu) { int i; - for (i = 1; i < MAX_VIRT_CPUS; i++) + for (i = 1; i < XEN_LEGACY_MAX_VCPUS; i++) d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1; } diff --git a/xen/arch/ia64/vmx/vmx_vcpu_save.c b/xen/arch/ia64/vmx/vmx_vcpu_save.c index db55279c64..50cfdacd94 100644 --- a/xen/arch/ia64/vmx/vmx_vcpu_save.c +++ b/xen/arch/ia64/vmx/vmx_vcpu_save.c @@ -228,7 +228,7 @@ static int vmx_cpu_load(struct domain *d, hvm_domain_context_t *h) struct pt_regs *regs; vcpuid = hvm_load_instance(h); - if (vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL) { + if (vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL) { gdprintk(XENLOG_ERR, "%s: domain has no vcpu %u\n", __func__, vcpuid); rc = -EINVAL; @@ -278,7 +278,7 @@ static int vmx_vpd_load(struct domain *d, hvm_domain_context_t *h) int i; vcpuid = hvm_load_instance(h); - if (vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL) { + if (vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL) { gdprintk(XENLOG_ERR, "%s: domain has no vcpu %u\n", __func__, vcpuid); rc = -EINVAL; diff --git a/xen/arch/ia64/xen/dom0_ops.c b/xen/arch/ia64/xen/dom0_ops.c index c2c1ea96e8..f27738d42d 100644 --- a/xen/arch/ia64/xen/dom0_ops.c +++ b/xen/arch/ia64/xen/dom0_ops.c @@ -233,7 +233,8 @@ long arch_do_domctl(xen_domctl_t *op, XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) goto sendtrigger_out; ret = -ESRCH; - if ( (v = d->vcpu[op->u.sendtrigger.vcpu]) == NULL ) + if ( op->u.sendtrigger.vcpu >= d->max_vcpus || + (v = d->vcpu[op->u.sendtrigger.vcpu]) == NULL ) goto sendtrigger_out; ret = 0; diff --git a/xen/arch/ia64/xen/dom_fw_dom0.c b/xen/arch/ia64/xen/dom_fw_dom0.c index 91ec3bb1a7..11639df53e 100644 --- a/xen/arch/ia64/xen/dom_fw_dom0.c +++ b/xen/arch/ia64/xen/dom_fw_dom0.c @@ -60,7 +60,7 @@ acpi_update_lsapic(struct acpi_subtable_header * header, const unsigned long end if (!lsapic) return -EINVAL; - if (lsapic_nbr < MAX_VIRT_CPUS && dom0->vcpu[lsapic_nbr] != NULL) + if (lsapic_nbr < dom0->max_vcpus && dom0->vcpu[lsapic_nbr] != NULL) enable = 1; else enable = 0; diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index bdc31323c9..7dde9bf33a 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -2118,6 +2118,7 @@ int __init construct_dom0(struct domain *d, /* Sanity! */ BUG_ON(d != dom0); + BUG_ON(d->vcpu == NULL); BUG_ON(d->vcpu[0] == NULL); BUG_ON(v->is_initialised); @@ -2222,7 +2223,7 @@ int __init construct_dom0(struct domain *d, // (we should be able to deal with this... later) /* Mask all upcalls... */ - for ( i = 1; i < MAX_VIRT_CPUS; i++ ) + for ( i = 1; i < XEN_LEGACY_MAX_VCPUS; i++ ) d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1; printk ("Dom0 max_vcpus=%d\n", dom0_max_vcpus); diff --git a/xen/arch/ia64/xen/hypercall.c b/xen/arch/ia64/xen/hypercall.c index 884bf7b4c3..24c25cbd83 100644 --- a/xen/arch/ia64/xen/hypercall.c +++ b/xen/arch/ia64/xen/hypercall.c @@ -84,7 +84,7 @@ fw_hypercall_ipi (struct pt_regs *regs) struct domain *d = current->domain; /* Be sure the target exists. */ - if (cpu > MAX_VIRT_CPUS) + if (cpu >= d->max_vcpus) return; targ = d->vcpu[cpu]; if (targ == NULL) diff --git a/xen/arch/ia64/xen/vhpt.c b/xen/arch/ia64/xen/vhpt.c index a7648fc7d1..f1689df0f4 100644 --- a/xen/arch/ia64/xen/vhpt.c +++ b/xen/arch/ia64/xen/vhpt.c @@ -231,7 +231,7 @@ domain_purge_swtc_entries_vcpu_dirty_mask(struct domain* d, { int vcpu; - for_each_vcpu_mask(vcpu, vcpu_dirty_mask) { + for_each_vcpu_mask(d, vcpu, vcpu_dirty_mask) { struct vcpu* v = d->vcpu[vcpu]; if (!v->is_initialised) continue; @@ -445,7 +445,7 @@ __domain_flush_vtlb_track_entry(struct domain* d, } if (HAS_PERVCPU_VHPT(d)) { - for_each_vcpu_mask(vcpu, entry->vcpu_dirty_mask) { + for_each_vcpu_mask(d, vcpu, entry->vcpu_dirty_mask) { v = d->vcpu[vcpu]; if (!v->is_initialised) continue; diff --git a/xen/include/asm-ia64/vcpumask.h b/xen/include/asm-ia64/vcpumask.h index 7a9773e411..fbd4cd1adc 100644 --- a/xen/include/asm-ia64/vcpumask.h +++ b/xen/include/asm-ia64/vcpumask.h @@ -31,12 +31,12 @@ static inline int __next_vcpu(int n, const vcpumask_t *srcp, int nbits) } #if MAX_VIRT_CPUS > 1 -#define for_each_vcpu_mask(vcpu, mask) \ +#define for_each_vcpu_mask(d, vcpu, mask) \ for ((vcpu) = first_vcpu(mask); \ - (vcpu) < MAX_VIRT_CPUS; \ + (vcpu) < d->max_vcpus; \ (vcpu) = next_vcpu((vcpu), (mask))) #else /* NR_CPUS == 1 */ -#define for_each_vcpu_mask(vcpu, mask) for ((vcpu) = 0; (vcpu) < 1; (vcpu)++) +#define for_each_vcpu_mask(d, vcpu, mask) for ((vcpu) = 0; (vcpu) < 1; (vcpu)++) #endif /* NR_CPUS */ #define vcpumask_scnprintf(buf, len, src) \